/**
 * Copyright (C) 2024 AIDC-AI
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.alibaba.langengine.claude.model.completion;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;

@Data
public class ChatCompletionResult {

    /**
     * Unique object identifier.
     */
    private String id;

    /**
     * Object type.
     * For Messages, this is always "message". 4xx is "error".
     *
     */
    private String type;

    /**
     * error detail.
     */
    private Error error;

    /**
     * Content generated by the model.
     * This is an array of content blocks, each of which has a type that determines its shape.
     */
    private List<Content> content;

    /**
     * The model that handled the request.
     */
    private String model;

    /**
     * The reason that we stopped.
     *
     * This may be one the following values:
     *
     * "end_turn": the model reached a natural stopping point
     * "max_tokens": we exceeded the requested max_tokens or the model's maximum
     * "stop_sequence": one of your provided custom stop_sequences was generated
     * "tool_use": the model invoked one or more tools
     * In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
     *
     * Available options: end_turn, max_tokens, stop_sequence, tool_use
     */
    @JsonProperty("stop_reason")
    private String stopReason;

    /**
     * Which custom stop sequence was generated, if any.
     *
     * This value will be a non-null string if one of your custom stop sequences was generated.
     */
    @JsonProperty("stop_sequence")
    private String stopSequence;

    /**
     * Billing and rate-limit usage.
     *
     * Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
     *
     * Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
     */
    private Usage usage;
}
